package graphics;

import java.util.ArrayList;

import models.PhysicalObject;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.Log;

/**
 * 
 * @author Merete, Mirna, Esben, Knut og Stian
 * 
 */
public class Painter {

	private static final String TAG = Painter.class.getSimpleName();;
	private ArrayList<PhysicalObject> objects;
	private Paint paint;
	private int screenWidth;
	private int screenHeight;

	public Painter(ArrayList<PhysicalObject> list, int screenWidth,
			int screenHeight) {
		objects = list;
		this.screenWidth = screenWidth;
		this.screenHeight = screenHeight;

		paint = new Paint();
		paint.setTextSize(75);
		paint.setColor(Color.BLACK);
	}

	/*
	 * 
	 *  Ask all the different objects to draw themselves
	 */
	public void draw(Canvas canvas) {
		for (PhysicalObject ob : objects) {
			if (ob.isActive()) {
				ob.draw(canvas);
			}
		}
	}

	public synchronized void drawGameOver(Canvas canvas) {
		canvas.drawText("Game Over!", screenHeight / 2, screenWidth / 2, paint);
		
	}

}
